<?php


namespace App\Http\Controllers\task;


use App\Engine\BaseController;
use App\Http\service\DyService;
use App\Http\service\GzhService;
use App\Jobs\GzhSendMessageJob;
use App\Jobs\TaskGzhJob;
use Illuminate\Support\Facades\Log;
use function app\Utils\go;
use App\Engine\TokenService;
use App\Models\User as UserModel;
use App\Models\Gzh as GzhModel;

class Task extends BaseController
{

    //使用程序需要条件
    //1.oss对象储存
    //2.即使通讯开启
    //3.reids
    //4.php artisan queue:work --timeout=0
    //5.php artisan queue:work --queue=taskQueue  --timeout=0
    //6.开启定时任务task
    public function start()
    {
      //  php artisan queue:work --queue=taskQueue  --timeout=0

        $this->getGzhUser();
    }

    public function send_message()
    {
        $data=$this->post;
        $is_token=TokenService::CheckTokenExpire($data["token"]);
        if(!$is_token)
            return go(["data"=>false]);
        GzhSendMessageJob::dispatch($data);
    }

    /**
     * 获取公众号用户
     */
    public function getGzhUser()
    {
        TaskGzhJob::dispatch()->onQueue("taskQueue");
    }

    public function dy_test()
    {

    }

}
